import {Collection} from '../model/Collection'
import {UICCHospital} from '../model/UICCHospital'
import {RestResult} from '../model/RestResult'
import { Injectable } from '@angular/core';
import { AuthHttp } from 'angular2-jwt'
import { Observable } from "rxjs/Observable";
import { Environment } from '../environments/environment'
import 'rxjs/add/operator/map';
import { RestResult } from '../common/model/rest-result'

@Injectable()
export class  CCHospitalControllerService {
  constructor (
    private http: AuthHttp,
    private env: Environment
  ){ }
  getHospitalList(): Observable<UICCHospital[]> {
    return this.http.get(this.env.urlPrefix + "/windbell/hospitals" ).map((res)=>{
    	let restResult = res.json() as RestResult<UICCHospital[]>
    	return restResult.value
    })
  }
}
